What are some goals we should aim for when writing unit tests?
Test many requirements in the same unit test so you can reduce the number of tests you write.
Unit tests should focus on the expected behavior and leave boundary checking to the Quality Assurance team.
Place as many lines into the @BeforeEach and @BeforeAll methods as you can, to keep your tests shorter, even if not all tests use those lines.
@BeforeEach
@BeforeAll
Keep your unit test names short, so they're easier to read in the logs.
Make sure to test all branching conditions in your tested method.
How much code coverage should we aim for?
50%
75%
90%
100%
Enough to make sure we test all our requirements.
Next Concept